<?php /*a:3:{s:94:"C:\project_xxxxxxxxxxxxxx\php_study\hemaphp\app\store\view\food\market\prepaid\card\index.html";i:1756643473;s:75:"C:\project_xxxxxxxxxxxxxx\php_study\hemaphp\app\store\view\layout\food.html";i:1756568970;s:93:"C:\project_xxxxxxxxxxxxxx\php_study\hemaphp\app\store\view\food\market\prepaid\tpl_goods.html";i:1756622680;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title><?php echo htmlentities($app_name); ?>管理后台</title>
	<meta name="author" content="<?php echo htmlentities($web['name']); ?>">
	<meta name="keywords" content="<?php echo htmlentities($web['keywords']); ?>">
	<meta name="description" content="<?php echo htmlentities($web['description']); ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1"/>
    <meta name="referrer" content="no-referrer-when-downgrade">
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="icon" href="/favicon.png" type="image/x-icon">
    <link rel="stylesheet" href="/assets/plugins/amazeui/amazeui.css?v=<?php echo htmlentities($version); ?>"/>
    <link rel="stylesheet" href="/assets/css/hema.app.css?v=<?php echo htmlentities($version); ?>"/>
    <link rel="stylesheet" href="/addons/upload/css/file.library.css?v=<?php echo htmlentities($version); ?>"/>
    <script src="/assets/plugins/jquery/jquery.min.js?v=<?php echo htmlentities($version); ?>"></script>
    <link rel="stylesheet" href="/assets/plugins/iconfont/iconfont.css?v=<?php echo htmlentities($version); ?>">
    <script src="/assets/plugins/iconfont/iconfont.js?v=<?php echo htmlentities($version); ?>"></script>
    <script>
        BASE_URL = "<?php echo isset($base_url) ? $base_url : ''; ?>";
        STORE_URL = "<?php echo isset($store_url) ? $store_url : ''; ?>";
        APPLET_ID = "<?php echo isset($applet_id) ? $applet_id : 0; ?>";
    </script>
</head>

<body data-type="">
<div class="am-g tpl-g">
    <!-- 头部 -->
    <header class="tpl-header">
        <!-- 右侧内容 -->
        <div class="tpl-header-fluid">
            <!-- 侧边切换 -->
            <div class="am-fl tpl-header-button switch-button">
                <i class="iconfont iconzhedie"></i>
            </div>
            <!-- 刷新页面 -->
            <div class="am-fl tpl-header-button refresh-button">
                <i class="iconfont iconshuaxin"></i>
            </div>
            <!-- 超链接-->
            <div class="am-fl tpl-header-navbar">
                <ul>
                    <!-- 网站首页 -->
                    <li class="am-text-sm">
                        <a href="/">
                            <i class="iconfont iconshouye"></i> 网站首页
                        </a>
                    </li>
                </ul>
            </div>
            <!-- 其它功能-->
			<div class="am-fr tpl-header-navbar">
				<ul>
				    <li class="am-text-sm"> 
					    <div class="am-dropdown" data-am-dropdown="{boundary: '.am-topbar'}">
							<div class="am-topbar-btn am-dropdown-toggle" data-am-dropdown-toggle>
								<img src="<?php echo htmlentities($user['user']['avatar']); ?>" /> 
								<?php echo htmlentities($user['user']['user_name']); ?>
								<span class="am-icon-caret-down"></span> 
							</div>
							<ul class="am-dropdown-content">
							    <li><a href="/user">用户中心</a></li>
								<li><a href="/store/<?php echo htmlentities($app_type); ?>.setting/renew">修改密码</a></li>
								<li><a href="/store/passport/<?php echo htmlentities($logout); ?>?app_type=<?php echo htmlentities($app_type); ?>">安全退出</a></li>
							</ul>
						</div>
					</li>
				</ul>
			</div>
        </div>
    </header>
    <!-- 侧边导航栏 -->
    <div class="left-sidebar dis-flex">
        <!-- 一级菜单 -->
        <ul class="sidebar-nav">
            <li class="sidebar-nav-heading"><?php echo htmlentities($app_name); ?> <small>V<?php echo htmlentities((isset($version) && ($version !== '')?$version:'1.0.0')); ?></small></li>
            <?php foreach($menus as $key => $item): ?>
                <li class="sidebar-nav-link">
                    <a href="<?php echo isset($item['index'])?url($item['index']):'javascript:void(0);'; ?>"
                       class="<?php echo !empty($item['active']) ? 'active' : ''; ?>">
                        <?php if(isset($item['is_svg']) && $item['is_svg'] === true): ?>
                            <svg class="icon sidebar-nav-link-logo" aria-hidden="true">
                                <use xlink:href="#<?php echo htmlentities($item['icon']); ?>"></use>
                            </svg>
                        <?php else: ?>
                            <i class="iconfont sidebar-nav-link-logo <?= $item['icon'] ?>"
                               style="color:<?php echo isset($item['color'])?$item['color']:''; ?>;"></i>
                        <?php endif; ?>
                        <?php echo htmlentities($item['name']); ?>
                    </a>
                </li>
            <?php endforeach; ?>
        </ul>
        <!-- 子级菜单-->
        <?php $second = isset($menus[$group]['submenu']) ? $menus[$group]['submenu'] : []; if(!empty($second)): ?>
            <ul class="left-sidebar-second">
                <li class="sidebar-second-title"><?php echo htmlentities($menus[$group]['name']); ?></li>
                <li class="sidebar-second-item">
                    <?php foreach($second as $item): if(!isset($item['submenu'])): ?>
                            <!-- 二级菜单-->
                            <a href="<?= url($item['index']) ?>" class="<?= $item['active'] ? 'active' : '' ?>">
                                <?= $item['name']; ?>
                            </a>
                        <?php else: ?>
                            <!-- 三级菜单-->
                            <div class="sidebar-third-item">
                                <a href="javascript:void(0);"
                                   class="sidebar-nav-sub-title <?php echo !empty($item['active']) ? 'active'  :  ''; ?>">
                                    <i class="iconfont icongengduo"></i>
                                    <?php echo htmlentities($item['name']); ?>
                                </a>
                                <ul class="sidebar-third-nav-sub">
                                    <?php foreach($item['submenu'] as $third): ?>
                                        <li>
                                            <a class="<?php echo !empty($third['active']) ? 'active'  :  ''; ?>"
                                               href="<?php echo url($third['index']); ?>">
                                                <?php echo htmlentities($third['name']); ?>
                                            </a>
                                        </li>
                                    <?php endforeach; ?>
                                </ul>
                            </div>
                        <?php endif; ?>
                    <?php endforeach; ?>
                </li>
            </ul>
        <?php endif; ?>
    </div>
    <!-- 内容区域 start -->
    <div class="tpl-content-wrapper <?php echo empty($second) ? 'no-sidebar-second' : ''; ?>">
        
<div class="row-content am-cf" id="appId">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">预付卡规则列表</div>
                </div>
                <div class="widget-body am-fr">
                    <div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
                        <div class="am-form-group">
                            <div class="am-btn-toolbar">
                                <div class="am-btn-group am-btn-group-sm">
                                    <a class="am-btn am-btn-primary am-radius"
                                       href="<?php echo url('food.market.prepaid.card/add'); ?>">
                                        <span class="am-icon-plus"></span> 新增
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="am-u-sm-12">
                        <table width="100%" class="am-table am-table-hover tpl-table-black">
                            <thead>
                            <tr>
                                <th>名称</th>
                                <th>门店</th>
                                <th>是否成组</th>
                                <th>一层规则(%)</th>
                                <th>二层规则(%)</th>
                                <th>三层规则(%)</th>
                                <th>四层规则(%)</th>
                                <th>五层规则(%)</th>
                                <th>创建时间</th>
                                <th>是否删除</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(sizeof($list) > 0): foreach($list as $item): ?>
                            <tr>
                                <td class="am-text-middle"><?php echo htmlentities($item['name']); ?></td>
                                <td class="am-text-middle"><?php echo htmlentities($item['shop_name']); ?></td>
                                <td class="am-text-middle">
                                    <?php if($item['is_group']==1): ?>
                                    成组分配
                                    <?php else: ?>
                                    成交即分配
                                    <?php endif; ?>
                                </td>
                                <td class="am-text-middle"><?php echo htmlentities($item['one_level_value']); ?></td>
                                <td class="am-text-middle"><?php echo htmlentities($item['two_level_value']); ?></td>
                                <td class="am-text-middle"><?php echo htmlentities($item['three_level_value']); ?></td>
                                <td class="am-text-middle"><?php echo htmlentities($item['four_level_value']); ?></td>
                                <td class="am-text-middle"><?php echo htmlentities($item['five_level_value']); ?></td>
                                <td class="am-text-middle"><?php echo htmlentities($item['create_time']); ?></td>
                                <td class="am-text-middle">
                                    <?php if($item['is_delete']==1): ?>
                                    <span class="am-text-danger">删除</span>
                                    <?php else: ?>
                                    未删除
                                    <?php endif; ?>
                                </td>
                                <td class="am-text-middle">
                                    <div class="tpl-table-black-operation">
                                        <?php if(empty($item['spu_id']) && $item['is_delete']!=1): ?>
                                        <a href="javascript:;" class="item-del tpl-table-black-operation-del"
                                           data-id="<?php echo htmlentities($item['id']); ?>">
                                            <i class="am-icon-trash"></i> 删除
                                        </a>
                                        <a href="javascript:;" @click="goods(<?php echo htmlentities($item['shop_id']); ?>)" class="tpl-table-black-operation-green">
                                            绑定商品sku
                                        </a>
                                        <?php endif; ?>
                                    </div>
                                </td>
                            </tr>
                            <?php endforeach; else: ?>
                            <tr>
                                <td colspan="7" class="am-text-center">暂无记录</td>
                            </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                    <div class="am-u-lg-12 am-cf">
                        <div class="am-fr"><?php echo $list->render(); ?></div>
                        <div class="am-fr pagination-total am-margin-right">
                            <div class="am-vertical-align-middle">总记录：<?php echo $list->total(); ?></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 商品 -->
<script id="tpl-goods-item" type="text/template">
    {{ each $data }}
    <div class="file-item">
        <div><img src="{{ $value.goods_image }}"></div>
        <div style="text-align: center;"><small>----{{ $value.goods_name }}</small></div>
        <input type="hidden" name="data[values][gift][id]" value="{{ $value.goods_id }}">
        <input type="hidden" name="data[values][gift][name]" value="{{ $value.goods_name }}">
        <input type="hidden" name="data[values][gift][image]" value="{{ $value.goods_image }}">
    </div>
    {{ /each }}
</script>



<script src="/assets/plugins/vue/vue.min.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/addons/food/js/select.data.js?v=<?php echo htmlentities($version); ?>"></script>
<script>
    // 渲染页面
    new Vue({
        el: '#appId',
        data: {
            type: 10,
            checked: 10
        },
        methods: {
            goods(shopId) {
                $.selectData({
                    width: "1000px",
                    limitLen:1,
                    title: '选择商品',
                    uri: 'goods/skulist?shopId='+shopId,
                    dataIndex: 'goods_id',
                    done: function (data) {
                        if(data.length>1){
                            layer.msg('只能选择一个商品sku');
                            return
                        }
                        $.post("<?php echo url('food.market.prepaid.card/bind'); ?>", data[0], function (result) {
                            if(typeof(result) == 'string'){
                                result = JSON.parse(result);
                            }
                            result.code === 1 ? $.show_success(result.msg, result.url) : $.show_error(result.msg);
                        });
                    }
                });
            }
        }
    });
    $(function () {
        // 删除元素
        var url = "<?php echo url('food.market.prepaid.card/delete'); ?>";
        $('.item-del').del('id', url);
    });
</script>
    </div>
    <!-- 内容区域 end -->

</div>
<script src="/assets/plugins/layer/layer.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/assets/plugins/jquery/jquery.form.min.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/assets/plugins/amazeui/amazeui.min.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/assets/js/hema.app.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/assets/js/webuploader.html5only.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/assets/js/art-template.js?v=<?php echo htmlentities($version); ?>"></script>
<script src="/addons/upload/js/file.library.js?v=<?php echo htmlentities($version); ?>"></script>
</body>

</html>
